/** COPYRIGHT(C) 2008. Loc Phan. All Rights Reserved.
    A java class that create charts
    @author Loc Phan
    @version 1.01 2008-11-11
*/


import java.awt.Graphics2D;
import java.awt.geom.Line2D;

import javax.swing.JComponent;

public class Chart extends JComponent{
	/**
	 * Constructs a chart
	 */
    public Chart()
    {
       x = y = 0;
    }
    /**Add a bar
     * 
     * @param value Height of a bar
     */
	public void add(int value)
	{
		y = value;
	}
	
	/**Draw a bar
	 * 
	 * @param g2 Graphics object
	 */
	public void draw(Graphics2D g2)
	{
		Line2D.Double line = new Line2D.Double(10+x,400,10+x,400-y);
		g2.draw(line);
		x+=10;	
	}
	private int x,y;
}
